package com.ambimmort.app.framework.listeners;

import javax.servlet.ServletContextEvent;

import com.ambimmort.app.framework.uitls.Application;
import com.ambimmort.ucagent.appframework.ModuleManager;
import com.ambimmort.ucagent.modules.AAAReader.AAAReader;
import com.ambimmort.ucagent.modules.server.ServerModule;
import com.ambimmort.ucagent.modules.webservice.WebServiceModule;
import org.apache.log4j.Logger;
import org.springframework.web.context.ContextLoaderListener;

public class SpringStartupListener extends ContextLoaderListener{

    static Logger logger = Logger.getLogger(SpringStartupListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent event) {

	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
        logger.info("NISP 3.0 Application Started Successfully.");
        logger.info("Working Dir: "+Application.getWorkingDir().getAbsolutePath());

        ModuleManager.getInstance().registerModule(new ServerModule());
//
//        ModuleManager.getInstance().registerModule(new WebServiceModule());

//        ModuleManager.getInstance().registerModule(new A3PubModule());

//        ModuleManager.getInstance().registerModule(new AAAReader());

        ModuleManager.getInstance().startAll();

        logger.info("UcAgent Service Started");
	}
	
	

}
